<template>
  <div>
    <ul class="list">
      <li v-for="(item, index) in data" :key="index">
        <div class="logo">
          <img v-if="item.patentType==='实用新型'" src="../../../../../assets/img/patentType-01.jpg" alt="">
          <img v-else src="../../../../../assets/img/patentType-02.jpg" alt="">
        </div>
        <div class="info-box">
          <h4 @click="toDetail(item)">{{item.name}}</h4>
          <div class="info">
            <p>
              <span>专利分值</span>
              <span>行业分类</span>
              <span>专利状态</span>
              <span>公开时间</span>
            </p>
            <p>
              <span>{{item.pingfen}}分</span>
              <span>能源</span>
              <span>{{item.type}}</span>
              <span>{{item.date}}</span>
            </p>
          </div>
        </div>
        <div class="tools">
          <button @click="toDetail(item)">查看详情</button>
          <button>关注</button>
        </div>
      </li>
    </ul>
    <!-- 分页 -->
    <el-pagination
      background
      @current-change="handleCurrentChange"
      layout="prev, pager, next"
      :current-page.sync="ipi"
      :page-size="ips"
      :total="total"
      style="text-align:center;margin-top:20px;margin-bottom:10px">
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Array
    }
  },
  data() {
    return {
      listData: [],
      ipi: 1,
      ips: 10,
      total: 0,
    }
  },
  methods: {
    toDetail(item) {
      this.$router.push({
        name:'ScienceFinancePatentDetail',
        query:{
          pn: item.pn,
          title: item.name
        }
      })
    },
    handleCurrentChange(val) {
      this.ipi = val
    }
  }
}
</script>

<style lang="scss" scoped>
.list {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  list-style: none;
  li {
    position: relative;
    display: block;
    width: 100%;
    min-height: 200px;
    margin-top: 20px;
    // box-sizing: border-box;
    &:last-of-type {
      &:after {
        border: 0;
      }
    }
    &:after {
      position: absolute;
      bottom: 0;
      left: 20px;
      width: calc(100% - 40px);
      border-bottom: 1px solid #ccc;
      content: '';
    }
    .logo {
      position: absolute;
      top: 0;
      left: 20px;
      z-index: 2;
      width: 180px;
      height: 180px;
      border: 1px solid #ccc;
      box-sizing: border-box;
      img {
        display: inline-block;
        width: 100%;
        height: 100%;
      }
    }
    .info-box {
      position: relative;
      padding-left: 220px;
      padding-right: 200px;
      h4 {
        margin-bottom: 20px;
        font-size: 22px;
        font-weight: 400;
        color: #333;
        cursor: pointer;
      }
      .info {
        position: relative;
        // max-width: 800px;
        padding: 10px 0;
        p {
          display: flex;
          span {
            flex: 1;
            line-height: 30px;
            padding: 0 10px;
            border-right: 1px solid #ccc;
            text-align: center;
            font-size: 13px;
            &:nth-of-type(1) {
              line-height: 40px;
            }
            &:last-of-type {
              border: 0;
            }
          }
        }
      }
    }
    .tools {
      position: absolute;
      top: 0;
      right: 0;
      width: 200px;
      height: 180px;
      text-align: center;
      button {
        width: 140px;
        height: 40px;
        border: 1px solid #000;
        border-radius: 4px;
        margin-top: 20px;
        text-align: center;
        font-size: 20px;
        outline: none;
        background-color: transparent;
        &:nth-of-type(1) {
          margin-top: 40px;
        }
      }
    }
  }
}
</style>